# -*- coding: utf-8 -*-
from distutils.core import setup
import py2exe
import sys
import matplotlib

matplotlib.use('Qt4Agg')

# this allows to run it with a simple double click.
sys.argv.append('py2exe')

py2exe_options = {
    # 'excludes': ['_gtkagg', '_tkagg'],
    'includes' : ['matplotlib.backends.backend_qt4agg'],
    'dll_excludes': ['MSVCP90.dll'],
    # 'dll_excludes': ['MSVCP90.dll','libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll'], # 需要排除的dll文件,如果不排除的话会报 No such file or directory错误
    'compressed': 2, # 是否压缩library.zip,当zipfile不为None时使用
    'optimize': 2, # 优化级别,默认为0
    # 'ascii': 0, # 不自动包含encodings和codecs,默认为0,包含
    'bundle_files': 2, # 3:不打包,2:打包除了Python解释器,1:当zipfile=None,生成一个exe文件,否则还生成一个library.zip
}

setup(
    name = u'pyside and matlibplot', # 产品名称
    version = '1.0', # 版本
    description = u'zhangjia_86@126.com', # 文件说明
    windows = [{'script': 'sin.py',}], # GUI程序
    # console = [{'script': 'test.py', 'icon_resources': [(1, 'images/1.ico')]}], # CLI程序
    zipfile = None, # 共享压缩文件的名字,None为打包到exe中，默认为library.zip
    options = {'py2exe': py2exe_options},
    data_files=matplotlib.get_py2exe_datafiles(),
)
